package cn.edu.tsinghua.xkk.correction;


import java.util.Comparator;

public class KanjiSort implements Comparator
{
	//min: 19968, max: 40866
	public int compare (Object X, Object Y)
	{
		Kanji A = (Kanji) X;
		Kanji B = (Kanji) Y;
		
		String x = Dictionary_cn.value(A.kanji);
		String y = Dictionary_cn.value(A.kanji);
		
		for (int i = 0; i < x.length() && i < y.length(); i++)
		{
			if (x.charAt(i) - y.charAt(i) > 0)
			{
				return 1;
			}
			else if (x.charAt(i) - y.charAt(i) < 0)
			{
				return -1;
			}
		}
		
		if (x.length() == y.length())
		{
			return 0;
		}
		else if (x.length() > y.length())
		{
			return 1;
		}
		else return -1;
	}
}
